package handler

import (
	"github.com/gin-gonic/gin"
	"gochat/domain/request"
	"gochat/domain/response/result"
	"gochat/service"
	"gochat/utils"
	"log"
)

func CreateGroup(c *gin.Context) {
	var body request.CreateGroupRequest
	err := c.ShouldBindBodyWithJSON(&body)
	if err != nil {
		log.Println(err)
		result.Fail(c, 400, "参数错误")
		return
	}
	service.Group.CreateGroup(c, body)
}

func GroupList(c *gin.Context) {
	uid, err := utils.GetUid(c)
	if err != nil {
		result.Fail(c, 400, "服务器异常")
		return
	}
	service.Group.GroupList(c, uid)
}

func DeleteGroup(context *gin.Context) {

}

func UpdateGroup(context *gin.Context) {

}
